package com.ruoyi.web.controller.utils;

import okhttp3.*;

import java.io.IOException;

public class OkHttpUtils {
    public static String get(String url) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "");
        Request request = new Request.Builder()
                .url(url)
                .method("GET",null)
                .addHeader("Content-Type", "application/json")
                .addHeader("Accept", "*/*")
                .addHeader("Connection", "keep-alive")
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }
}
